#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.59)
AC_INIT(src/banssh.c)



if test -f VERSION; then
  VERSION=`cat VERSION`
  echo "Version set to $VERSION"
else
  VERSION='0.0.0'
fi
AM_INIT_AUTOMAKE(banssh, $VERSION )



# Checks for programs.
AC_PROG_CC
#CFLAGS='-Wall -W -O2 -s -pipe -lssl -lcrypto -lauparse -laudit -pthread'
#CFLAGS='-W -O2 -s -pipe -lssl -lcrypto -lauparse -laudit -pthread'
# Checks for libraries.
# FIXME: Replace `main' with a function in `-lfl':
# Checks for libraries.

AC_CHECK_LIB([audit], [audit_log_acct_message])
AC_CHECK_LIB([auparse], [auparse_flush_feed])
AC_CHECK_LIB([crypto], [CRYPTO_set_id_callback])
AC_CHECK_LIB([ssl], [SSL_free])






# Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h unistd.h])


AC_C_CONST
AC_C_INLINE
AC_CHECK_SIZEOF([unsigned int])
AC_CHECK_SIZEOF([unsigned long])
AM_PROG_CC_C_O




# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T


# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CHECK_FUNCS([strcasecmp])






##########
# Do we want to support for debugging
#
AC_ARG_ENABLE(syslogmsgs,
AC_HELP_STRING([--enable-syslogmsgs],[Support extra debug messages]),,enable_syslogmsgs=no)
AC_MSG_CHECKING([whether to support syslogmsgs operation])
if test "$enable_syslogmsgs" = "no"; then
  BANSSH_DBF=0
  BANSSH_SYSLOGMSGS=""
  AC_MSG_RESULT([no])
else
  BANSSH_SYSLOGMSGS="-DDEBUG_SYSL"
  BANSSH_DBF=1
  AC_MSG_RESULT([yes])
fi


AC_SUBST(BANSSH_SYSLOGMSGS)









INCLUDES="$INCLUDES -I/usr/local/include"
AC_SUBST(INCLUDES)
AC_SUBST(LIB_CFLAGS)
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
